package com.finace.money.presenter;

import com.finace.money.data.bean.DealRecordListBean;
import com.finace.money.net.rto_rxbuild.RxHttpReponseCompat;
import com.finace.money.net.rto_subscriber.ProgressSubcriber;
import com.finace.money.presenter.contract.DealRecordContract;

import javax.inject.Inject;

/**
 * Created by zhangpeng on 2018/1/27.
 */

public class DealRecordPresenter extends BasePresenter<DealRecordContract.IDealRecordModel,DealRecordContract.View> {

    @Inject
    public DealRecordPresenter(DealRecordContract.IDealRecordModel iDealRecordModel, DealRecordContract.View view) {
        super(iDealRecordModel, view);
    }

    public void getList(final int type, String pagerSize, String pageNumber){

        mModel.getDealRecordList(type,pagerSize,pageNumber).compose(RxHttpReponseCompat.<DealRecordListBean>compatResult())
                .subscribe(new ProgressSubcriber<DealRecordListBean>(mContext,mView) {
                    @Override
                    public void onNext(DealRecordListBean dealRecordListBean) {
                        if(hasView()){
                            mView.getDealRecordListSucess(type,dealRecordListBean);
                        }
                    }
                });

    }

}
